#pragma once
#include "resource.h"
#include "ToyotaPJ.h"
#include "defs.h"

int GetDtcItemMenu(int *DtcCurIDArr, int *DtcIndexArr, int *DtcShowDataPtr, tt_Token *token, DtcRecDataSt *DtcRecDataPtr);
int ClearFreezeData(tt_Token *a1);
int ShowDtcInterface(int *DtcIDArr, int *DtcIndexArr, int **DtcShowDataPtr, DtcRecDataSt *DtcRecDataPtr, tt_Token *token, unsigned __int8 *goldtoken);
void ShowNoDtcMenu(tt_Token *a1);

unsigned __int16 ClearDtcAddGetDtcInfo(int *DtcIDArr, int *DtcIndexArr, int **Ptr, DtcRecDataSt *DtcRecDataPtr, tt_Token *token, unsigned __int8 *goldtoken);
unsigned __int16 CheckDtcDataInfo(int **DtcDataPtr, DtcRecDataSt *DtcDataBuf, tt_Token *token);

unsigned __int16 SendCmdAndGetDtc(int A1, int A2, char *Val, int **DtcDataPtr, DtcRecDataSt *DtcDataBuf, tt_Token *token);
int GetDTCCodeFromAns(int UpRecvLen, unsigned __int8 *RecvBuf, int DtcRulerVal, int *DtcDataPtr, int A2, tt_Token *token);
int SiftDTCCodeP4(int a1, tt_Token *token);

int GetDiagCodeP4_TS(int CurSysIndex, int **Ptr, DtcRecDataSt *DtcDataBuf, tt_Token *token);
unsigned __int16 GetFrzSupport(int *DtcShowData, DtcRecDataSt *DtcRecodData, tt_Token *token);
int GetFrzSupport_DKROOF(int *DataShow, int v20, DtcRecDataSt* a2, tt_Token* token);
int GetFrzSupport_DKCGW(int *DataShow, int v20, tt_Token* token);
int GetPendingFrzSupportAddNonDt(int*, DtcRecDataSt*, tt_Token*);
int GetDtcListInfo(DtcRecDataSt *AllocAddr, tt_Token *token);
int GetDtcListInfo_P3P4(DtcRecDataSt * result, tt_Token *token);
int GetDtcListInfo_P5(DtcRecDataSt* result, tt_Token *token);
int InitDtcNum(int DtcID, char *Buf, int NumVal);
int GetShowDtcInfo(int a1, int TextID, char *a3, char *pTextBuf, char *pTextBuf2, tt_Token *token);


int IdSearch(int ID, char *IDContentBuf, int MaxSize, int fp);
int GetFreezeSupportFlag(int a1, int a2, tt_Token *a3);
int ShowDtcHelpInterface(int a1);

unsigned __int16 GetDiagCodeCARB(int CurSysIndex, int **Ptr, DtcRecDataSt *DtcDataBuf, tt_Token *token);

unsigned __int16 GetDiagCodeHisFrz_TS(int CurSysIndex, int **Ptr, DtcRecDataSt *DtcDataBuf, tt_Token *token);
unsigned __int16 GetDiagCodeNoFrmNoV2(int CurSysIndex, int **Ptr, DtcRecDataSt *DtcDataBuf, tt_Token *token);

unsigned __int16 GetDiagCodeOsEngV2(int CurSysIndex, int **Ptr, DtcRecDataSt *DtcDataBuf, tt_Token *token);
unsigned __int16 GetDiagCodePSAV2(int CurSysIndex, int **Ptr, DtcRecDataSt *DtcDataBuf, tt_Token *token);

int GetDTCCodePSAAudioFromAns(int Index, unsigned __int8 *RecvBuf, int Len, int *ptr);
unsigned __int16 GetDiagCodePSA_Audio(int CurSysIndex, int **Ptr, DtcRecDataSt *DtcDataBuf, tt_Token *token);
unsigned __int16 GetDiagCodeTSL_EV(int CurSysIndex, int **Ptr, DtcRecDataSt *DtcDataBuf, tt_Token *token);
int GetDTCCodeTSL_EVFromAns(int Index, unsigned __int8 *RecvBuf, int Len, int *ptr);

int GetDiagCodeV2(int CurSysIndex, int **Ptr, DtcRecDataSt *DtcDataBuf, tt_Token *token);
unsigned __int16 GetDiagCodeP5(int CurSysIndex, int **DataShowinfo, DtcRecDataSt *DtcDataBuf, tt_Token *token);
int GetCodeP5StateMask(int CurSysIndex, tt_Token *token, unsigned __int8 *a3, unsigned __int8 *a4);

int GetDiagCodeDKISO9141(int CurSysIndex, int **Ptr, DtcRecDataSt *DtcDataBuf, tt_Token *token);
int GetDTCCodeDKISO9141FromAns(int a1, unsigned __int8 *a2, int *ptr);
unsigned int * GetDTCCodeP5FromAns(unsigned int Index, int Count, unsigned __int8 *RecvBuf, int a4, unsigned int *a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14, int a15, int a16, int a17, int a18, int a19, int a20, int a21, int a22, int a23, int a24, int a25, int a26, int a27, int a28, int a29, int a30, int a31, int a32, int a33, int a34, int a35, int a36, int a37, int a38, tt_Token *token);
int SetDiagCodeData(int Index, int a2, int CompareNum, _BYTE *a4, char *a5);
int SiftDTCCodeP5(int a1, tt_Token *a2);

int GetDTCCodePSAV2FromAns(int upRecvLen, unsigned __int8 *RecvBuf, int Len, int *ptr, tt_Token *token);
int GetSSRNoInfoFunc_1(int a1, unsigned __int8 *a2);
int SetCmdToSndFrameFunc_1(int CompareVal, unsigned __int8 *a2, tt_Token *a3);

int GetDataIdForDmData(int a1, unsigned __int8 *a2, unsigned __int8 *a3);
int AnalyzeSingleDataId(int a1, int a2, tt_Token *token, int *a4, unsigned __int8 *a5, unsigned __int8 *a6);

int FreeDiagCodePointerP5(int result, DiagCodeP5* a2);


